package day05;

import java.util.Scanner;

public class MethodDemo2 {
    public static void main(String[] args) {
        int len, max;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入长度");
        len = scanner.nextInt();

        System.out.println("请输入最大值");
        max = scanner.nextInt();

        int[] a,a2;
        a=generateArray(len, max);
        System.out.println("第一个元素的值"+a[0]);

        for (int i=0;i<a.length;i++){
            System.out.print(a[i]+" ");
        }
        System.out.println();

        a2=generateArray(len, max);
        System.out.println("第二个元素的值"+a2[1]);
        for (int i=0;i<a2.length;i++){
            System.out.print(a2[i]+" ");
        }

    }
    public static int[] generateArray(int len ,int max){
        int[] arr = new int[len];
        for(int i=0; i<arr.length; i++){
            arr[i] = (int)(Math.random()*max);
        }
        return arr;
    }
}
